[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+----------+###############################################################
#+-| RANDOM() |-------------------------------------------------------+#######
#| +----------+ Returns a randomly entered number between 0 and 32167 |#######
#+--------------------------------------------------------------------+#######
##############################################################################
##############################################################################
#+--| Summary |------------+##################################################
#| #INCLUDE io.hdr |##################################################
#+-------------------------+##################################################
##############################################################################
##############################################################################
#+--| Syntax |----------------------------+###################################
#| FUNCTION UINT random PROTOTYPE |###################################
#| PARAMETERS VALUE UINT seed |###################################
#+----------------------------------------+###################################
##############################################################################
##############################################################################
#########+---| Description |-----------------------------------------+########
#########| The random() function returns a randomly generated number |########
#########| between 0 and 32167 based upon a seed. Call the random |########
#########| function once with a seed number to initialize a sequence |########
#########| of random digits. All subsequent calls with seed = 0 |########
#########| return a sequence of digits. |########
#########+-----------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Test a best fit function with random data. |#########
#########| |#########
#########| random_num = random( i_str( substr( 4,2,time() ) ) ) |#########
#########| DO WHILE inkey() = 0 |#########
#########| DO best_fit WITH random_num |#########
#########| random_num = random( 0 ) |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Create a random database to check performances. |#########
#########| |#########
#########| random( 44 ) && generate a sequence of |#########
#########| && numbers based upon seed |#########
#########| && value 44. |#########
#########| |#########
#########| INPUT "How many records? " TO rec_count |#########
#########| DO WHILE rec_count > 0 |#########
#########| APPEND BLANK |#########
#########| REPLACE a->numfld WITH random(0) |#########
#########| rec_count = rec_count - 1 |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
i_str()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson